# -*- coding: utf-8 -*-
# Author: xiantingDeng
# File: 05_完成多任务.py
# Time: 21:53


# def demo1():
#     while True:
#         print("---1---")
#         yield None
#
# def demo2():
#     while True:
#         print("---2----")
#         yield None
#
# t1 = demo1()
# t2 = demo2()
# while True:
#     t1.__next__()
#     t2.__next__()


def gen_example():
    print('before any yield')

    yield 'first yield'

    print('between yields')

    yield 'second yield'

    print('no yield anymore')


gen = gen_example()
gen.__next__()  # 第一次调用显示 before any yield
gen.__next__()  # 第二次调用 显示 between yields
# gen.__next__()  # 第三次调用 显示 no yield anymore
# gen.__next__()
